import React from 'react';
import { Row, Col, Table, Button, Form, Input, InputNumber, Alert, Icon, Spin, Select, Modal, DatePicker, TimePicker, Switch} from 'antd';
import moment from 'moment';
import { NavLink } from 'react-router-dom'
import Axios from '../../assets/js/axios'
import Utils from '../../assets/js/utils'
const FormItem = Form.Item;
const Option = Select.Option;

class GasUser extends React.Component {
    state = {
        selectedRowKeys: [],
        selectedRows:[],
        data: [],
        visibility: false,
        alertInfo: {},
        loading: true,
        isShowMeterSearch: false,
        title: '',
        num: "0"
    }

    params = {
        page: 1,
        cityInfo: {}
    }

    componentWillMount() {
        this.mounted = true
        //初始化获取数据
        this.getUserList()
        if(this.mounted) {
            this.setState({
                visibility: false,
                alertInfo: {}
            })
        }
    }

    //获取数据
    getUserList = (obj = {}) => {
        Axios.requestList(this,'/api/meters/queryUseMetersByCondition', 'get', this.params, obj )
    }

    //向设备发送指令
    sendMetersInstructions= (obj = {}) => {
        if (obj.cmd_type === "9052" && obj.err_code === "") {
            return
        }
        Axios.ajax({
            url: '/api/meters/sendMetersInstructions',
            methods: 'post',
            params: obj
        }).then((res) => {
            if(res) {
                this.setState({
                    isShowMeterSearch: false,
                    visibility: true,
                    alertInfo: res
                })
            }
        })
    }

    

    //点击行，多选框选中
    onRowClick = (record) => {
        const selectedRowKeys = [...this.state.selectedRowKeys];
        const selectedRows = [...this.state.selectedRows];
        if (selectedRowKeys.indexOf(record.key) >= 0) {
            selectedRowKeys.splice(selectedRowKeys.indexOf(record.key), 1);
        } else {
            selectedRowKeys.push(record.key);
        }
        if (selectedRows.indexOf(record) >= 0) {
            selectedRows.splice(record, 1);
        } else {
            selectedRows.push(record);
        }
        if(this.mounted) {
            this.setState({
                selectedRowKeys,
                selectedRows
            });
        }
    }

    //查询方法
    filterUserSubmit = () => {
        let cityInfo = this.cityForm.props.form.getFieldsValue();
        this.getUserList(cityInfo)
    }

    //查询重置方法
    filterUserReset = () => {
        this.getUserList()
        this.cityForm.props.form.resetFields();
    }

    filterMeterChange = (value) => {
        let titleArr = {'0': '高级搜索', '9052': '故障清除', '9041': '远程开阀', '9042': '远程关阀', '9011': '主站IP设置', '9013': '上报周期设置', '9015': '自醒上报时间设置', '9021': '冻结日设置', '9093': '表具编号设置', '9094': '报警参数设置', '9095': '燃气表底数设置', '9096': 'RTC校时设置'};
        if(value && value === 0) {
            this.setState({
                isShowMeterSearch: true,
                title: titleArr[value],
                num: value
            })
        } else {
            if(value === "0" || this.state.selectedRowKeys.length) {
                this.setState({
                    isShowMeterSearch: true,
                    title: titleArr[value] ? titleArr[value] : '查询',
                    num: value
                })
            } else {
                Modal.info({
                    title: '警告',
                    content: '请选择一条数据！',
                    okText: '确定'
                })
            }
        }
    }

    //模态框提交事件
    handleUseMeterSubmit = (num) => {
        let meter_no = []
        this.params.cityInfo = this.cityForm.props.form.getFieldsValue();
        this.state.selectedRows.map((item) => {
            return meter_no.push(item.meter_no)
        })
        this.params.cityInfo.meter_no = meter_no
        this.params.page = 1;
        if (num === "0") {
            //高级搜索
            //对时间进行转换
            if (this.params.cityInfo["bef_date"]) {
                this.params.cityInfo["bef_date"] = this.params.cityInfo["bef_date"].format("YYYY-MM-DD")
            }
            this.getUserList(this.params.cityInfo)
        } else {
            //向设备发送指令
            this.sendMetersInstructions(this.params.cityInfo)
        }
        this.setState({
            isShowMeterSearch: false
        })
    }

    onClose = (e) => {
        if(this.mounted) {
            this.setState({
                visibility: false
            })
        }
    }

    componentWillUnmount() {
        this.mounted = false
    }

    render() {
        const selectedRowKeys = this.state.selectedRowKeys;
        const rowSelection = {
            type: 'checkbox',
            selectedRowKeys,
            //使用onRow方法，点击多选框也能选中
            onChange: (selectedRowKeys, selectedRows) => {
                this.setState({
                    selectedRowKeys,
                    selectedRows
                })
            }
        };
        const columns = [
            {
                title: '表具编号',
                dataIndex: 'meter_no',
                width: 160,
                render: text => <NavLink to={`/dashboard/useMeter/show/${text}`}>{text}</NavLink>
            },
            {
                title: '用户编号',
                dataIndex: 'user_id',
                width: 140
            },
            {
                title: '用户姓名',
                dataIndex: 'user_name',
                width: 90
            },
            {
                title: '用户地址',
                dataIndex: 'user_address',
            },
            {
                title: '冻结日期',
                dataIndex: 'bef_date',
                width: 180,
                render(bef_date) {
                    return Utils.formateDate(bef_date)
                }
            },
            {
                title: '冻结底数',
                dataIndex: 'bef_read',
                width: 90
            },
            {
                title: '最新上报日期',
                dataIndex: 'now_date',
                width: 180,
                render(now_date) {
                    return Utils.formateDate(now_date)
                }
            },
            {
                title: '最新上报底数',
                dataIndex: 'now_read',
                width: 110
            },
            {
                title: '设备状态',
                dataIndex: 'err_code',
                width: 90
            },
            {
                title: '阀门状态',
                dataIndex: 'valve_state',
                width: 90
            }/*,
            {
                title: '环境温度',
                dataIndex: 'env_temp',
                width: 90
            }*/
        ];
        return (
            <div>
                {
                    this.state.visibility ? <div className="alert"><Alert {...this.state.alertInfo}></Alert> <Icon onClick={this.onClose} type="close" /> </div> : null
                }
                <Row>
                    <Col span={24}>
                        <FilterForm
                            wrappedComponentRef={(inst) => {this.cityForm = inst;}}
                            filterReset={() => {this.filterUserReset()}}
                            filterSubmit={() => {this.filterUserSubmit()}}
                            filterChange = {(value) => {this.filterMeterChange(value)}}
                        />
                    </Col>
                </Row>
                <Row style={{marginTop: 20}}>
                    <Spin spinning={this.state.loading} tip="加载中。。。">
                        <Table bordered
                               rowSelection={rowSelection}
                               columns={columns}
                               dataSource={this.state.data}
                               pagination = {this.state.totalRecord < 21 ? false : this.state.pagination}
                               locale={{emptyText: '暂无数据'}}
                               scroll={{x: 1600}}
                               onRow = {(record, index) => {
                                   return {
                                       onClick: () => {
                                           this.onRowClick(record, index)
                                       }
                                   }
                               }}
                        />
                    </Spin>
                </Row>
                <Modal title={this.state.title} visible={this.state.isShowMeterSearch} onCancel={() => {
                    this.setState({
                        isShowMeterSearch: false
                    })
                }}
                       onOk={() => {this.handleUseMeterSubmit(this.state.num)}}
                >
                    <OpenMeterSearch wrappedComponentRef={(inst) => {this.cityForm = inst;}} num={this.state.num}/>
                </Modal>
            </div>
        );
    }
}

export default GasUser;

//查询列表
class  FilterForm extends React.Component {
    handleUserSubmit = () => {
        this.props.filterSubmit();
    }

    handleUserReset = () => {
        this.props.filterReset();
    }

    handleChange = (value) => {
        this.props.filterChange(value);
    }

    render() {
        const {getFieldDecorator} = this.props.form;
        return (
            <Form layout="inline">
                <FormItem label="表具编号">
                    {
                        getFieldDecorator('meter_no')(
                            <Input autoComplete="off" />
                        )
                    }
                </FormItem>
                <FormItem>
                    <Button type="primary" onClick={() => {this.handleUserSubmit()}} style={{marginLeft: 10}}>搜索</Button>
                    <Button style={{marginLeft: '20px'}} onClick={() => {this.handleUserReset()}}>刷新</Button>
                    <Button style={{margin: '0 20px'}} type="primary" onClick={() => {this.handleChange("0")}}>高级搜索</Button>
                    <Select placeholder="控制指令" style={{ width: 180 }} onSelect={(value) => {this.handleChange(value)}}>
                        <Option value="9052">故障清除</Option>
                        <Option value="9041">远程开阀</Option>
                        <Option value="9042">远程关阀</Option>
                        <Option value="9011">主站IP设置</Option>
                        <Option value="9013">上报周期设置</Option>
                        <Option value="9015">自醒上报时间设置</Option>
                        <Option value="9021">冻结日设置</Option>
                        <Option value="9093">表具编号设置</Option>
                        <Option value="9094">报警参数设置</Option>
                        <Option value="9095">燃气表底数设置</Option>
                        <Option value="9096">RTC校时设置</Option>
                    </Select>
                    <Select placeholder="查询指令" style={{ width: 180, margin: '0 20px' }} onSelect={(value) => {this.handleChange(value)}}>
                        <Option value="9012">主站IP查询</Option>
                        <Option value="9014">上报周期查询</Option>
                        <Option value="9016">自醒上报时间查询</Option>
                        <Option value="9022">冻结日查询</Option>
                        <Option value="9031">近60日日用量查询</Option>
                        <Option value="9032">近120月月用量查询</Option>
                        <Option value="9035">累计用量查询</Option>
                        <Option value="9053">故障事件查询</Option>
                    </Select>
                </FormItem>
            </Form>
        )
    }
}
FilterForm = Form.create({})(FilterForm);

class OpenMeterSearch extends React.Component {
    state = {
        tilt_alarm_is_off_checked: false,
        tilt_alarm_is_off_disabled: true,
        box_alarm_is_off_checked: false,
        box_alarm_is_off_disabled: true
    };

    changeTiltAlarmRadioState = (checked) => {
        this.setState({
            tilt_alarm_is_off_checked: checked,
            tilt_alarm_is_off_disabled: !checked
        })
    };

    changeTilteAlarmRadioState = (checked) => {
        this.setState({
            tilt_alarm_is_off_checked: checked
        })
    }

    changeBoxAlarmRadioState = (checked) => {
        this.setState({
            box_alarm_is_off_checked: checked,
            box_alarm_is_off_disabled: !checked
        })
    }

    changeBoxAlarmRadio = (checked) => {
        this.setState({
            box_alarm_is_off_checked: checked
        })
    }

    render() {
        const formItemLayout = {
            labelCol: {
                span: 5
            },
            wrapperCol: {
                span: 19
            }
        };

        const formItemLayout1 = {
            labelCol: {
                span: 8
            },
            wrapperCol: {
                span: 16
            }
        };
        const {getFieldDecorator} = this.props.form;
        return (
            <Form layout="horizontal">
                {
                    this.props.num === "0" ?
                        (
                            <div>
                                <FormItem label="用户编号" {...formItemLayout}>
                                    {
                                        getFieldDecorator('user_id', {
                                        })(
                                            <Input autoComplete="off" placeholder="请输入用户编号" />
                                        )
                                    }
                                </FormItem>
                                <FormItem label="用户姓名" {...formItemLayout}>
                                    {
                                        getFieldDecorator('user_name', {
                                        })(
                                            <Input autoComplete="off" placeholder="请输入用户姓名" />
                                        )
                                    }
                                </FormItem>
                                <FormItem label="用户地址" {...formItemLayout}>
                                    {
                                        getFieldDecorator('user_address', {
                                        })(
                                            <Input autoComplete="off" placeholder="请输入用户地址" />
                                        )
                                    }
                                </FormItem>
                                <FormItem label="冻结日期" {...formItemLayout}>
                                    {
                                        getFieldDecorator('bef_date', {
                                        })(
                                            <DatePicker />
                                        )
                                    }
                                </FormItem>
                                <FormItem label="异常类型" {...formItemLayout}>
                                    {
                                        getFieldDecorator('err_code', {
                                            initialValue: ""
                                        })(
                                            <Select showSearch filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}>
                                                <Option value="">请选择</Option>
                                                <Option value="0001">强行关阀</Option>
                                                <Option value="0002">燃气泄漏</Option>
                                                <Option value="0004">传感器坏</Option>
                                                <Option value="0008">存储异常</Option>
                                                <Option value="0010">强磁干扰</Option>
                                                <Option value="0020">死表故障</Option>
                                                <Option value="0040">阀门漏气</Option>
                                                <Option value="0080">电池故障</Option>
                                                <Option value="0100">倾斜故障</Option>
                                                <Option value="0200">开盒报警</Option>
                                                <Option value="0400">失联关阀</Option>
                                                <Option value="0800">异常流量</Option>
                                            </Select>
                                        )
                                    }
                                </FormItem>
                                <FormItem label="阀门状态" {...formItemLayout}>
                                    {
                                        getFieldDecorator('valve_state', {
                                            initialValue: ""
                                        })(
                                            <Select>
                                                <Option value="">请选择</Option>
                                                <Option value="1">开</Option>
                                                <Option value="0">关</Option>
                                            </Select>
                                        )
                                    }
                                </FormItem>
                            </div>
                        ) : ''
                }

                {
                    this.props.num === "9052" ?
                        (
                            <div>
                                <FormItem label="异常类型" {...formItemLayout}>
                                    {
                                        getFieldDecorator('err_code', {
                                            initialValue: ""
                                        })(
                                            <Select showSearch filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}>
                                                <Option value="">请选择</Option>
                                                <Option value="0001">强行关阀</Option>
                                                <Option value="0002">燃气泄漏</Option>
                                                <Option value="0004">传感器坏</Option>
                                                <Option value="0008">存储异常</Option>
                                                <Option value="0010">强磁干扰</Option>
                                                <Option value="0020">死表故障</Option>
                                                <Option value="0040">阀门漏气</Option>
                                                <Option value="0080">电池故障</Option>
                                                <Option value="0100">倾斜故障</Option>
                                                <Option value="0200">开盒报警</Option>
                                                <Option value="0400">失联关阀</Option>
                                                <Option value="0800">异常流量</Option>
                                            </Select>
                                        )
                                    }
                                </FormItem>
                                <FormItem colon={false} {...formItemLayout} style={{display: 'none'}}>
                                    {
                                        getFieldDecorator('cmd_type', {
                                            initialValue: this.props.num
                                        })(
                                            <Input type="hidden" />
                                        )
                                    }
                                </FormItem>
                            </div>
                        ) : ''
                }

                {
                    this.props.num === "9011" ?
                        (
                            <div>
                                <FormItem label="ip" {...formItemLayout}>
                                    {
                                        getFieldDecorator('ip', {
                                        })(
                                            <Input autoComplete="off" placeholder="请输入ip" />
                                        )
                                    }
                                </FormItem>
                                <FormItem label="端口" {...formItemLayout}>
                                    {
                                        getFieldDecorator('port', {
                                        })(
                                            <Input autoComplete="off" placeholder="请输入端口" />
                                        )
                                    }
                                </FormItem>
                                <FormItem colon={false} {...formItemLayout} style={{display: 'none'}}>
                                    {
                                        getFieldDecorator('cmd_type', {
                                            initialValue: this.props.num
                                        })(
                                            <Input type="hidden" />
                                        )
                                    }
                                </FormItem>
                            </div>
                        ) : ''
                }

                {
                    this.props.num === "9013" ?
                        (
                            <div>
                                <FormItem label="上报周期" {...formItemLayout}>
                                    {
                                        getFieldDecorator('cycle', {
                                            initialValue: "0"
                                        })(
                                            <Select>
                                                <Option value="0">请选择</Option>
                                                <Option value="时">时</Option>
                                                <Option value="天">天</Option>
                                            </Select>
                                        )
                                    }
                                </FormItem>
                                <FormItem colon={false} {...formItemLayout} style={{display: 'none'}}>
                                    {
                                        getFieldDecorator('cmd_type', {
                                            initialValue: this.props.num
                                        })(
                                            <Input type="hidden" />
                                        )
                                    }
                                </FormItem>
                            </div>
                        ) : ''
                }

                {
                    this.props.num === "9015" ?
                        (
                            <div>
                                <FormItem label="每天自醒时间" {...formItemLayout1}>
                                    {
                                        getFieldDecorator('wake_time', {
                                        })(
                                            <TimePicker defaultOpenValue={moment('00:00:00', 'HH:mm:ss')} />
                                        )
                                    }
                                </FormItem>
                                <FormItem label="自醒时长(s)" {...formItemLayout1}>
                                    {
                                        getFieldDecorator('wake_duration', {
                                            initialValue: "25"
                                        })(
                                            <Input autoComplete="off" disabled />
                                        )
                                    }
                                </FormItem>
                                <FormItem label="错峰延迟因子(s)" {...formItemLayout1}>
                                    {
                                        getFieldDecorator('peak_staggering_delay_factor', {
                                        })(
                                            <Input autoComplete="off" placeholder="请输入错峰延迟因子" />
                                        )
                                    }
                                </FormItem>
                                <FormItem colon={false} {...formItemLayout} style={{display: 'none'}}>
                                    {
                                        getFieldDecorator('cmd_type', {
                                            initialValue: this.props.num
                                        })(
                                            <Input type="hidden" />
                                        )
                                    }
                                </FormItem>
                            </div>
                        ) : ''
                }

                {
                    this.props.num === "9021" ?
                        (
                            <div>
                                <FormItem label="冻结日" {...formItemLayout}>
                                    {
                                        getFieldDecorator('bef_date', {
                                        })(
                                            <InputNumber min={1} max={28} placeholder="请输入1~28的数字" style={{width: '100%'}} />
                                        )
                                    }
                                </FormItem>
                                <FormItem colon={false} {...formItemLayout} style={{display: 'none'}}>
                                    {
                                        getFieldDecorator('cmd_type', {
                                            initialValue: this.props.num
                                        })(
                                            <Input type="hidden" />
                                        )
                                    }
                                </FormItem>
                            </div>
                        ) : ''
                }

                {
                    this.props.num === "9093" ?
                        (
                            <div>
                                <FormItem label="新表具编号" {...formItemLayout}>
                                    {
                                        getFieldDecorator('new_meter_no', {
                                        })(
                                            <Input autoComplete="off" placeholder="请输入新表具编号" />
                                        )
                                    }
                                </FormItem>
                                <FormItem colon={false} {...formItemLayout} style={{display: 'none'}}>
                                    {
                                        getFieldDecorator('cmd_type', {
                                            initialValue: this.props.num
                                        })(
                                            <Input type="hidden" />
                                        )
                                    }
                                </FormItem>
                            </div>
                        ) : ''
                }

                {
                    this.props.num === "9094" ?
                        (
                            <div>
                                <FormItem label="死表天数" {...formItemLayout}>
                                    {
                                        getFieldDecorator('dead_watch_days', {
                                        })(
                                            <Input autoComplete="off" placeholder="请输入死表天数" />
                                        )
                                    }
                                </FormItem>
                                <FormItem label="失联天数" {...formItemLayout}>
                                    {
                                        getFieldDecorator('lost_connection_days', {
                                        })(
                                            <Input autoComplete="off" placeholder="请输入失联天数" />
                                        )
                                    }
                                </FormItem>
                                <FormItem label="过流天数" {...formItemLayout}>
                                    {
                                        getFieldDecorator('overflowing_days', {
                                        })(
                                            <Input autoComplete="off" placeholder="请输入过流天数" />
                                        )
                                    }
                                </FormItem>
                                <div style={{height: 54}}>
                                    <Col span={5} style={{textAlign: 'right', marginTop: 9}}>
                                        开盒报警：
                                    </Col>
                                    <Col span={7}>
                                        <FormItem colon={false}>
                                            {
                                                getFieldDecorator('tilt_alarm_is_enable', {
                                                    valuePropName: 'checked'
                                                })(
                                                    <Switch checkedChildren="开" unCheckedChildren="关" onChange={this.changeTiltAlarmRadioState} />
                                                )
                                            }
                                        </FormItem>
                                    </Col>
                                    <Col span={5} style={{textAlign: 'right', marginTop: 9}}>
                                        是否关阀：
                                    </Col>
                                    <Col span={7}>
                                        <FormItem colon={false}>
                                            {
                                                getFieldDecorator('tilt_alarm_is_off', {
                                                })(
                                                    <Switch checkedChildren="开" unCheckedChildren="关" checked={this.state.tilt_alarm_is_off_checked} onChange={this.changeTilteAlarmRadioState} disabled={this.state.tilt_alarm_is_off_disabled}/>
                                                )
                                            }
                                        </FormItem>
                                    </Col>
                                </div>
                                <div style={{height: 54}}>
                                    <Col span={5} style={{textAlign: 'right', marginTop: 9}}>
                                        倾斜报警：
                                    </Col>
                                    <Col span={7}>
                                        <FormItem colon={false}>
                                            {
                                                getFieldDecorator('box_alarm_is_enable', {
                                                })(
                                                    <Switch checkedChildren="开" unCheckedChildren="关" onChange={this.changeBoxAlarmRadioState} />
                                                )
                                            }
                                        </FormItem>
                                    </Col>
                                    <Col span={5} style={{textAlign: 'right', marginTop: 9}}>
                                        是否关阀：
                                    </Col>
                                    <Col span={7}>
                                        <FormItem colon={false}>
                                            {
                                                getFieldDecorator('box_alarm_is_off', {
                                                })(
                                                    <Switch checkedChildren="开" unCheckedChildren="关" checked={this.state.box_alarm_is_off_checked} onChange={this.changeBoxAlarmRadio} disabled={this.state.box_alarm_is_off_disabled} />
                                                )
                                            }
                                        </FormItem>
                                    </Col>
                                </div>
                                <FormItem colon={false} {...formItemLayout} style={{display: 'none'}}>
                                    {
                                        getFieldDecorator('cmd_type', {
                                            initialValue: this.props.num
                                        })(
                                            <Input type="hidden" />
                                        )
                                    }
                                </FormItem>
                            </div>
                        ) : ''
                }

                {
                    this.props.num === "9095" ?
                        (
                            <div>
                                <FormItem label="燃气表底数" {...formItemLayout}>
                                    {
                                        getFieldDecorator('basis', {
                                        })(
                                            <Input autoComplete="off" placeholder="请输入燃气表底数" />
                                        )
                                    }
                                </FormItem>
                                <FormItem colon={false} {...formItemLayout} style={{display: 'none'}}>
                                    {
                                        getFieldDecorator('cmd_type', {
                                            initialValue: this.props.num
                                        })(
                                            <Input type="hidden" />
                                        )
                                    }
                                </FormItem>
                            </div>
                        ) : ''
                }

                {
                    this.props.num === "9041" ?
                        (
                            <div>
                                <FormItem colon={false} {...formItemLayout}>
                                    确定要执行远程开阀操作？
                                </FormItem>
                                <FormItem colon={false} {...formItemLayout} style={{display: 'none'}}>
                                    {
                                        getFieldDecorator('cmd_type', {
                                            initialValue: this.props.num
                                        })(
                                            <Input type="hidden" />
                                        )
                                    }
                                </FormItem>
                            </div>
                        ) : ''
                }

                {
                    this.props.num === "9042" ?
                        (
                            <div>
                                <FormItem colon={false} {...formItemLayout}>
                                    确定要执行远程关阀操作？
                                </FormItem>
                                <FormItem colon={false} {...formItemLayout} style={{display: 'none'}}>
                                    {
                                        getFieldDecorator('cmd_type', {
                                            initialValue: this.props.num
                                        })(
                                            <Input type="hidden" />
                                        )
                                    }
                                </FormItem>
                            </div>
                        ) : ''
                }

                {
                    this.props.num === "9096" ?
                        (
                            <div>
                                <FormItem colon={false} {...formItemLayout}>
                                    确定要进行RTC校时设置？
                                </FormItem>
                                <FormItem colon={false} {...formItemLayout} style={{display: 'none'}}>
                                    {
                                        getFieldDecorator('cmd_type', {
                                            initialValue: this.props.num
                                        })(
                                            <Input type="hidden" />
                                        )
                                    }
                                </FormItem>
                            </div>
                        ) : ''
                }

                {
                    this.props.num === "9012" ?
                        (
                            <div>
                                <FormItem colon={false} {...formItemLayout}>
                                    确定要进行主站IP查询？
                                </FormItem>
                                <FormItem colon={false} {...formItemLayout} style={{display: 'none'}}>
                                    {
                                        getFieldDecorator('cmd_type', {
                                            initialValue: this.props.num
                                        })(
                                            <Input type="hidden" />
                                        )
                                    }
                                </FormItem>
                            </div>
                        ) : ''
                }

                {
                    this.props.num === "9014" ?
                        (
                            <div>
                                <FormItem colon={false} {...formItemLayout}>
                                    确定要进行上报周期查询？
                                </FormItem>
                                <FormItem colon={false} {...formItemLayout} style={{display: 'none'}}>
                                    {
                                        getFieldDecorator('cmd_type', {
                                            initialValue: this.props.num
                                        })(
                                            <Input type="hidden" />
                                        )
                                    }
                                </FormItem>
                            </div>
                        ) : ''
                }

                {
                    this.props.num === "9016" ?
                        (
                            <div>
                                <FormItem colon={false} {...formItemLayout}>
                                    确定要进行自醒上报时间查询？
                                </FormItem>
                                <FormItem colon={false} {...formItemLayout} style={{display: 'none'}}>
                                    {
                                        getFieldDecorator('cmd_type', {
                                            initialValue: this.props.num
                                        })(
                                            <Input type="hidden" />
                                        )
                                    }
                                </FormItem>
                            </div>
                        ) : ''
                }

                {
                    this.props.num === "9022" ?
                        (
                            <div>
                                <FormItem colon={false} {...formItemLayout}>
                                    确定要进行冻结日查询？
                                </FormItem>
                                <FormItem colon={false} {...formItemLayout} style={{display: 'none'}}>
                                    {
                                        getFieldDecorator('cmd_type', {
                                            initialValue: this.props.num
                                        })(
                                            <Input type="hidden" />
                                        )
                                    }
                                </FormItem>
                            </div>
                        ) : ''
                }

                {
                    this.props.num === "9031" ?
                        (
                            <div>
                                <FormItem colon={false} {...formItemLayout}>
                                    确定要进行近60日日用量查询？
                                </FormItem>
                                <FormItem colon={false} {...formItemLayout} style={{display: 'none'}}>
                                    {
                                        getFieldDecorator('cmd_type', {
                                            initialValue: this.props.num
                                        })(
                                            <Input type="hidden" />
                                        )
                                    }
                                </FormItem>
                            </div>
                        ) : ''
                }

                {
                    this.props.num === "9032" ?
                        (
                            <div>
                                <FormItem colon={false} {...formItemLayout}>
                                    确定要进行近120月月用量查询？
                                </FormItem>
                                <FormItem colon={false} {...formItemLayout} style={{display: 'none'}}>
                                    {
                                        getFieldDecorator('cmd_type', {
                                            initialValue: this.props.num
                                        })(
                                            <Input type="hidden" />
                                        )
                                    }
                                </FormItem>
                            </div>
                        ) : ''
                }

                {
                    this.props.num === "9035" ?
                        (
                            <div>
                                <FormItem colon={false} {...formItemLayout}>
                                    确定要进行累计用量查询？
                                </FormItem>
                                <FormItem colon={false} {...formItemLayout} style={{display: 'none'}}>
                                    {
                                        getFieldDecorator('cmd_type', {
                                            initialValue: this.props.num
                                        })(
                                            <Input type="hidden" />
                                        )
                                    }
                                </FormItem>
                            </div>
                        ) : ''
                }

                {
                    this.props.num === "9053" ?
                        (
                            <div>
                                <FormItem colon={false} {...formItemLayout}>
                                    确定要进行故障事件查询？
                                </FormItem>
                                <FormItem colon={false} {...formItemLayout} style={{display: 'none'}}>
                                    {
                                        getFieldDecorator('cmd_type', {
                                            initialValue: this.props.num
                                        })(
                                            <Input type="hidden" />
                                        )
                                    }
                                </FormItem>
                            </div>
                        ) : ''
                }
            </Form>
        )
    }
}
OpenMeterSearch = Form.create({})(OpenMeterSearch);